from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from goods.models import SPU

from goods.models import SPUSpecification
from meiduo_admin.serialziers.specs import SPUSpecificationSerializer, SPUSerializer
from meiduo_admin.utils import PageNum


class SpecsView(ModelViewSet):
    serializer_class = SPUSpecificationSerializer
    queryset = SPUSpecification.objects.all()
    pagination_class = PageNum

    def simple(self,request):
        spus=SPU.objects.all()
        ser=SPUSerializer(spus,many=True)
        return Response(ser.data)